<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/include/include.jsp"%>
<div id="page_${now.time}">
<form action="<c:if test="${not empty role}"><c:url value="/role/edit"/></c:if><c:if test="${empty role}"><c:url value="/role/add"/></c:if>" 
	method="post" onsubmit="return validateCallback(this, navTabAjaxDone)">
<div style="padding: 5px;">
	<div class="tabs">
		<div class="tabsHeader">
			<div class="tabsHeaderContent">
				<ul>
					<li><a href="javascript:;"><span><fmt:message key="page.role.baseinfo"/></span></a></li>
					<li><a href="javascript:;"><span><fmt:message key="page.role.permissioninfo"/></span></a></li>
					<li><a href="javascript:;"><span><fmt:message key="page.role.userinfo"/></span></a></li>
				</ul>
			</div>
		</div>
		<div class="tabsContent" layoutH="80">
			<div>
				<fieldset>
					<dl>
						<dt><fmt:message key="page.role.rolecode"/>：</dt>
						<dd style="margin: 3px 0px;">
							<input name="code" type="text" size="30" value="${role.code}"
					 			<c:if test="${not empty role}"> readonly="readonly"</c:if> class="required {rangelength:[2,32]}"/>
						</dd>
					</dl>
					<dl>
						<dt><fmt:message key="page.role.rolename"/>：</dt>
						<dd style="margin: 3px 0px;">
							<input name="name" type="text" size="30" value="${role.name}" class="required"/>
						</dd>
					</dl>
					<dl class="nowrap">
						<dt><fmt:message key="page.role.remark"/>：</dt>
						<dd style="margin: 3px 0px;">
							<textarea rows="4" cols="90" name="remark">${role.remark}</textarea>
						</dd>
					</dl>
				</fieldset>
			</div>
			<!-- 基本信息结束 -->
			<div style="padding: 5px;">
				<table class="list" style="width:98%">
					<thead>
						<tr>
							<th><input type="checkbox" group="permission" class="checkboxCtrl"><fmt:message key="page.role.permissionname"/></th>								
							<th><fmt:message key="page.role.permissioncode"/></th>
							<th><fmt:message key="page.role.permissiongroup"/></th>
							<th><fmt:message key="page.role.permissiontype"/></th>
						</tr>
					</thead>
					<tbody>
						<c:if test="${not empty permissionGroup}">						
							<c:forEach items="${permissionGroup}" var="group">
								<c:forEach items="${group.rmpPermissions}" var="permission">
									<tr>
										<td>
											<input type="checkbox" name="permission" value="${permission.code}" <c:if test="${permission.checked}">checked</c:if>>
											${permission.name}
										</td>
										<td>
											${permission.code}
										</td>
										<td>${group.name}</td>
										<td>
											<c:choose>
												<c:when test="${permission.rmpPermissionType.code eq 'FUNCTION'}"><fmt:message key="page.role.permissiontype.function"/></c:when>
												<c:when test="${permission.rmpPermissionType.code eq 'MENU'}"><fmt:message key="page.role.permissiontype.menu"/></c:when>
											</c:choose>
										</td>
									</tr>
								</c:forEach>
								<tr><td colspan="4">&nbsp;</td></tr>
							</c:forEach>
						</c:if>
					</tbody>
				</table>
			</div>
			<!-- 权限信息结束 -->
			<div style="padding: 5px;">
				<table class="list" style="width: 98%">
					<thead>
						<tr>
							<th><input type="checkbox" group="userCode" class="checkboxCtrl"><fmt:message key="page.role.usercode"/></th>
							<th><fmt:message key="page.role.username"/></th>
							<th><fmt:message key="page.role.userdept"/></th>
						</tr>
					</thead>
					<tbody>
						<c:if test="${not empty userList}">
							<c:forEach items="${userList}" var="user">
								<tr>
									<td>
										<input type="checkbox" name="userCode" value="${user.code}" <c:if test="${user.checked}">checked</c:if>>
										${user.code}
									</td>
									<td>
										${user.name }
									</td>
									<td>
										${user.rmpDept.name}
									</td>
								</tr>
							</c:forEach>
						</c:if>
					</tbody>
				</table>
			</div>
			<!-- 用户信息结束 -->
		</div>
	</div>
</div>
<div class="formBar">
	<ul>
		<c:if test="${readOnly ne '1'}">
			<youthburin:hasAnyPermissions name="role:add,role:edit">
				<li><div class="buttonActive"><div class="buttonContent"><button type="submit"><fmt:message key="page.button.save"/></button></div></div></li>
			</youthburin:hasAnyPermissions>
		</c:if>
		<li><div class="button"><div class="buttonContent"><button type="button" class="close"><fmt:message key="page.button.cancel"/></button></div></div>	</li>
	</ul>
</div>
</form>
</div>